<template>
  <div class="warp">
    <div class="warp-title">
      <ul class="warp-tap">
        <li v-for="(v, i) in arr" :key="i">
          <span :class="i==index?'title':''" @click="fun(i)">{{ v.name }}</span>
        </li>
      </ul>
    </div>
    <div class="warp-content"></div>
  </div>
</template>

<script>
import getlink from "@/api/getapi.js";
export default {
  data() {
    return {
      arr: [],
      index:0
    };
  },
  created() {
    getlink("/data/list").then((ok) => {
      this.arr = ok.data.groups;
    });
  },
  methods: {
    fun(i) {
      this.index=i
    },
  },
};
</script>

<style scoped>
.warp {
  width: 100%;
  /* position: relative; */
}
.warp-title {
  width: 100%;
  position: relative;
}
.warp-tap {
  height: 0.6rem;
  display: flex;
  overflow-x: auto;
  padding: 0 0.2rem;
  position: sticky;
  justify-content: flex-start;
}
.warp-tap li {
  padding: 0 0.1rem;
  height: 0.4rem;
  flex-shrink: 0;
  font-size: 0.16rem;
  padding-top: 0.16rem;
  line-height: 0.25rem;
}
.title {
  padding-bottom: 0.1rem;
  font-size: 0.21rem;
  border-bottom: 2px solid #2fcfbb;
}
</style>